package cn.collin.commons.dao;

import java.io.Serializable;
import java.util.List;

/**
 * http://collincode.googlecode.com
 * 
 * @author collin.code@gmail.com
 * 
 */
public interface BaseDao {

	/**
	 * Return the persistent instance of the given entity class with the given
	 * identifier
	 * 
	 * @param entityClass
	 *            a persistent class
	 * @param id
	 *            an identifier of the persistent instance
	 * @return the persistent instance
	 */
	public Object retrieveById(Serializable id);

	public Object retrieveById(Class entityClass, Serializable id);

	/**
	 * Return the persistent instance of the given entity class with the given
	 * identifier, or null if not found.
	 * 
	 * @param entityClass
	 *            a persistent class
	 * @param id
	 *            an identifier of the persistent instance
	 * @return the persistent instance, or null if not found
	 */
	public Object getById(Serializable id);

	public Object getById(Class entityClass, Serializable id);

	/**
	 * update entity
	 * 
	 * @param entity
	 */
	public void update(Object entity);

	/**
	 * 
	 * @param entity
	 */
	public void create(Object entity);

	public void delete(Serializable id);

	public void delete(Class entityClass, Serializable id);

	/**
	 * 
	 * @param entityName
	 * @param ids
	 */
	public void deleteWithIndependent(String[] ids);

	public void deleteWithIndependent(String entityName, String[] ids);

	/**
	 * 
	 * @param entityClass
	 * @param idsFS
	 */
	public void deleteWithDependent(String[] ids);

	public void deleteWithDependent(Class entityClass, String[] ids);

	public List findAll();
}
